home *** CD-ROM | disk | FTP | other *** search
- ; $Id: d_contour.pro,v 1.23 1997/04/21 22:05:15 tremblay Exp $
- ;
- ; Copyright (c) 1997, Research Systems, Inc. All rights reserved.
- ; Unauthorized reproduction prohibited.
- ;
- ;+
- ; FILE:
- ; d_contour.pro
- ;
- ; CALLING SEQUENCE: d_contour
- ;
- ; PURPOSE:
- ; Shows several feature of contour plots
- ; (direct and object graphics).
- ;
- ; MAJOR TOPICS: Plots and widgets
- ;
- ; CATEGORY:
- ; IDL 5.0
- ;
- ; INTERNAL FUNCTIONS and PROCEDURES:
- ; fun GetColorArray - Returns the color array
- ; fun GetContourColor - Returns the color of a given level
- ; pro MakeBasic - Create the basic contour plot
- ; pro MakeColor - Create the plot with colored lines
- ; pro MakeFill - Create the fill contour plot
- ; pro MakeLinestyle - Create the plot with various line stlyes
- ; pro MakeAnnotation - Create the plot with annotations
- ; pro MakeFillAndLine - Create the fill plot with overlaying lines
- ; pro d_contour_Event - Event handler
- ; pro d_contourCleanup - Cleanup
- ; pro d_contour - Main procedure
- ;
- ; EXTERNAL FUNCTIONS, PROCEDURES, and FILES:
- ; pro gettips - Get the tips text structure..
- ; pro widtips - Create the widget text for tips.
- ; contr.txt
- ; contr.tip
- ; worldelv.dat
- ;
- ; REFERENCE: IDL Reference Guide, IDL User's Guide
- ;
- ; NAMED STRUCTURES:
- ; none.
- ;
- ; COMMON BLOCS:
- ; none.
- ;
- ; MODIFICATION HISTORY: Written by: DAT, RSI, December 96
- ;-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Assign a color to the polyline
- ;
- function GetColorArray, $
- highColor, $ ; IN: highest color index.
- nLevels ; IN: number of contour levels.
-
- if (nLevels eq 15) then begin
- ColorArray = [0, 4, 11, 9, 3, 10, 5, 8, 2, 6, 13, 12, 14, 15, 1 ]
- endif else if (nLevels eq 11) then begin
- ColorArray = [0, 11, 9, 10, 5, 8, 2, 6, 12, 15, 1 ]
- endif else begin
- ColorArray = [0, 11, 5, 8, 2, 15, 1 ]
- endelse
- ColorArray = colorArray + highColor
-
- RETURN, colorArray
-
- end ; of GetColorArray
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Assign a color to the polyline
- ;
- function GetContourColor, $
- level, $ ; IN: level index
- nLevels ; IN: number of levels
-
- highColor = !D.TABLE_SIZE-18 + 1
- colorArray = GetColorArray( highColor, nLevels)
- index = ColorArray[level]
- TVLCT, Red, Green, Blue, /GET
-
- RETURN, [Red[index], Green[index], Blue[index]]
-
- end
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Create a contour plot with white solid lines
- ; (direct graphics)
- ;
- pro MakeBasic, $
- data, $ ; IN: data (n by m)
- WindowID, $ ; IN: window identifier (pixmap)
- DrawXSize, $ ; IN: x dimension of drawing area
- DrawYSize, $ ; IN: y dimension of drawing area
- highColor, $ ; IN highest color index of color table
- AX=ax, $ ; IN: x rotation (in degree)
- AZ=az, $ ; IN: z rotation (in degree)
- NLevels=nLevels ; IN: number of levels
-
-
- LOADCT, 5, /SILENT
- TEK_COLOR, !D.TABLE_SIZE-18, 16
-
- sf_x = (FLOAT(drawYSize) / FLOAT(drawXSize)) < 1.0
- sf_y = (FLOAT(drawXSize) / FLOAT(drawYSize)) < 1.0
-
- WSET, windowID
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XSTYLE=5, YSTYLE=5, TICKLEN=(-0.02), ZSTYLE=5
- Empty
-
- CONTOUR, data, COLOR=highColor+1, $
- NLEVELS=nLevels, /NODATA, $
- BACKGROUND=highColor, $
- XSTYLE=1, YSTYLE=1, TICKLEN=(-0.02), ZSTYLE=5, $
- XTICKS=4, YTICKS=4, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XTICKNAME=['0', '90', '180', '270', '0'], $
- YTICKNAME=['-90', '-45', '0', '+45', '+90'], $
- /NOERASE
- Empty
-
- end
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Create a contour plot colored lines
- ; (direct graphics)
- ;
- pro MakeColor, $
- data, $ ; IN: data (n by m)
- WindowID, $ ; IN: window identifier (pixmap)
- DrawXSize, $ ; IN: x dimension of drawing area
- DrawYSize, $ ; IN: y dimension of drawing area
- highColor, $ ; IN highest color index of color table
- AX=ax, $ ; IN: x rotation (in degree)
- AZ=az, $ ; IN: z rotation (in degree)
- NLevels=nLevels ; IN: number of levels
-
-
- LOADCT, 5, /SILENT
- TEK_COLOR, !D.TABLE_SIZE-18, 16
-
- sf_x = (FLOAT(drawYSize) / FLOAT(drawXSize)) < 1.0
- sf_y = (FLOAT(drawXSize) / FLOAT(drawYSize)) < 1.0
-
- WSET, windowID
-
- colorArray = GetColorArray(highColor, nLevels)
-
- CONTOUR, data, COLOR=highColor+17, $
- BACKGROUND=highColor, $
- C_COLORS=colorArray, NLEVELS=nLevels, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XSTYLE=5, YSTYLE=5, TICKLEN=(-0.02), ZSTYLE=5
- Empty
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, /NODATA, $
- XSTYLE=1, YSTYLE=1, TICKLEN=(-0.02), ZSTYLE=5, $
- XTICKS=4, YTICKS=4, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XTICKNAME=['0', '90', '180', '270', '0'], $
- YTICKNAME=['-90', '-45', '0', '+45', '+90'], $
- /NOERASE
- Empty
-
- end
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Create a filled contour plot
- ; (direct graphics)
- ;
- pro MakeFill, $
- data, $ ; IN: data (n by m)
- WindowID, $ ; IN: window identifier (pixmap)
- DrawXSize, $ ; IN: x dimension of drawing area
- DrawYSize, $ ; IN: y dimension of drawing area
- highColor, $ ; IN highest color index of color table
- AX=ax, $ ; IN: x rotation (in degree)
- AZ=az, $ ; IN: z rotation (in degree)
- NLevels=nLevels ; IN: number of levels
-
-
- LOADCT, 5, /SILENT
- TEK_COLOR, !D.TABLE_SIZE-18, 16
-
- sf_x = (FLOAT(drawYSize) / FLOAT(drawXSize)) < 1.0
- sf_y = (FLOAT(drawXSize) / FLOAT(drawYSize)) < 1.0
-
- WSET, windowID
-
- colorArray = GetColorArray(highColor, nLevels)
-
- CONTOUR, data, COLOR=highColor+17, $
- BACKGROUND=highColor, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- C_COLORS=colorArray, NLEVELS=nLevels, /FILL, $
- XSTYLE=5, YSTYLE=5, TICKLEN=(-0.02), ZSTYLE=5
- Empty
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, /NODATA, $
- XSTYLE=1, YSTYLE=1, TICKLEN=(-0.02), ZSTYLE=5, $
- XTICKS=4, YTICKS=4, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XTICKNAME=['0', '90', '180', '270', '0'], $
- YTICKNAME=['-90', '-45', '0', '+45', '+90'], $
- /NOERASE
- Empty
-
- end
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Create a contour plot with varios linestyle
- ; (direct graphics)
- ;
- pro MakeLinestyle, $
- data, $ ; IN: data (n by m)
- WindowID, $ ; IN: window identifier (pixmap)
- DrawXSize, $ ; IN: x dimension of drawing area
- DrawYSize, $ ; IN: y dimension of drawing area
- highColor, $ ; IN highest color index of color table
- AX=ax, $ ; IN: x rotation (in degree)
- AZ=az, $ ; IN: z rotation (in degree)
- NLevels=nLevels ; IN: number of levels
-
-
- LOADCT, 5, /SILENT
- TEK_COLOR, !D.TABLE_SIZE-18, 16
-
- sf_x = (FLOAT(drawYSize) / FLOAT(drawXSize)) < 1.0
- sf_y = (FLOAT(drawXSize) / FLOAT(drawYSize)) < 1.0
-
- WSET, windowID
- lineStyle = [0,1,2,3,4,5]
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- C_LINESTYLE=lineStyle, $
- XSTYLE=5, YSTYLE=5, TICKLEN=(-0.02), ZSTYLE=5
- Empty
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, /NODATA, $
- XSTYLE=1, YSTYLE=1, TICKLEN=(-0.02), ZSTYLE=5, $
- XTICKS=4, YTICKS=4, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XTICKNAME=['0', '90', '180', '270', '0'], $
- YTICKNAME=['-90', '-45', '0', '+45', '+90'], $
- /NOERASE
- Empty
-
- end
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Create a contour plot with annotations
- ; (direct graphics)
- ;
- pro MakeAnnotation, $
- data, $ ; IN: data (n by m)
- WindowID, $ ; IN: window identifier (pixmap)
- DrawXSize, $ ; IN: x dimension of drawing area
- DrawYSize, $ ; IN: y dimension of drawing area
- highColor, $ ; IN highest color index of color table
- AX=ax, $ ; IN: x rotation (in degree)
- AZ=az, $ ; IN: z rotation (in degree)
- NLevels=nLevels ; IN: number of levels
-
- ; Use the Hersey font.
- ;
- !P.FONT = -1
-
- ; Create 7 contour levels here.
- ;
- LOADCT, 5, /SILENT
- TEK_COLOR, !D.TABLE_SIZE-18, 16
-
- WSET, windowID
-
-
- ; Define the levels and their corresponding
- ; annotations which are the elevation in meters.
- ;
- levels = [42B, 84B, 105b, 125B, 145b, 169B, 213B]
- annotation = STRTRIM(levels * 40 - 5000, 2)
- nLevels = N_ELEMENTS(levels)
-
- colorArray = GetColorArray(highColor, nLevels)
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, $
- C_COLORS=colorArray, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation (in meters)', $
- C_ANNOTATION=Annotation, /FOLLOW, C_CHARSIZE=1.25, $
- XSTYLE=5, YSTYLE=5, TICKLEN=(-0.02), ZSTYLE=5
- Empty
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, /NODATA, $
- XSTYLE=1, YSTYLE=1, TICKLEN=(-0.02), ZSTYLE=5, $
- XTICKS=4, YTICKS=4, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation (in meters)', $
- XTICKNAME=['0', '90', '180', '270', '0'], $
- YTICKNAME=['-90', '-45', '0', '+45', '+90'], $
- /NOERASE
- Empty
-
- ; Restore the hardware drawn font.
- ;
- !P.FONT = 0
-
- end
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Create a filled contour plot with lines
- ; (direct graphics)
- ;
- pro MakeFillAndLine, $
- data, $ ; IN: data (n by m)
- WindowID, $ ; IN: window identifier (pixmap)
- DrawXSize, $ ; IN: x dimension of drawing area
- DrawYSize, $ ; IN: y dimension of drawing area
- highColor, $ ; IN highest color index of color table
- AX=ax, $ ; IN: x rotation (in degree)
- AZ=az, $ ; IN: z rotation (in degree)
- NLevels=nLevels ; IN: number of levels
-
-
- LOADCT, 5, /SILENT
- TEK_COLOR, !D.TABLE_SIZE-18, 16
-
- sf_x = (FLOAT(drawYSize) / FLOAT(drawXSize)) < 1.0
- sf_y = (FLOAT(drawXSize) / FLOAT(drawYSize)) < 1.0
-
- WSET, windowID
-
- colorArray = GetColorArray(highColor, nLevels)
-
- CONTOUR, data, COLOR=highColor+17, $
- BACKGROUND=highColor, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- C_COLORS=colorArray, NLEVELS=nLevels, /FILL, $
- XSTYLE=5, YSTYLE=5, TICKLEN=(-0.02), ZSTYLE=5
-
- CONTOUR, data, COLOR=highColor+17, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, /OVERPLOT, FONT=-1
-
- Empty
-
- CONTOUR, data, COLOR=highColor+1, $
- BACKGROUND=highColor, $
- NLEVELS=nLevels, /NODATA, $
- XSTYLE=1, YSTYLE=1, TICKLEN=(-0.02), ZSTYLE=5, $
- XTICKS=4, YTICKS=4, $
- YTITLE='Latitude', XTITLE='Longitude', $
- TITLE='World Elevation', $
- XTICKNAME=['0', '90', '180', '270', '0'], $
- YTICKNAME=['-90', '-45', '0', '+45', '+90'], $
- /NOERASE
- Empty
-
- end
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE Handle the event
- ;
- pro d_contour_Event, $
- sEvent ; IN: event structure
-
- if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ $
- 'WIDGET_KILL_REQUEST') then begin
- WIDGET_CONTROL, sEvent.top, /DESTROY
- RETURN
- endif
-
-
- WIDGET_CONTROL, sEvent.id, GET_UVALUE=eventUValue
- eventName = WIDGET_INFO(sEvent.id,/NAME)
-
- ; Handle the event for the direct graphics or the slider.
- ;
- if ( (eventUValue eq 'SELECTD') or $
- (eventUValue eq 'NLEVELS') ) then begin
-
- WIDGET_CONTROL, sEvent.top, GET_UVALUE=sInfo, /NO_COPY
- WIDGET_CONTROL, sInfo.wLevelSlider, GET_VALUE=levelValue
-
- ; Here, level value is 1, 2, or 3. We want to
- ; have the number of levels to be 7, 11, or 15.
- ;
- sInfo.nLevels = levelValue*4 + 3
- WIDGET_CONTROL, sInfo.wSelectDButton, GET_VALUE=selection
- WSET, sInfo.drawDWindowID
-
- WIDGET_CONTROL, sInfo.wLevelLabel, $
- SET_VALUE=STRING(sInfo.nLevels, FORMAT='(i2)')
-
- case selection of
-
- ; Create the basic contour
- ;
- 0 : begin
- WIDGET_CONTROL, sInfo.wLevelSlider, SENSITIVE=1
- MakeBasic , sInfo.data, sInfo.drawDWindowID, $
- sInfo.drawXSize, sInfo.drawYSize, $
- sInfo.highColor, $
- AX=sInfo.xRotation, AZ=sInfo.zRotation, $
- NLEVELS=sInfo.nlevels
- end
-
- ; Create the contour with colored lines.
- ;
- 1 : begin
- WIDGET_CONTROL, sInfo.wLevelSlider, SENSITIVE=1
- MakeColor , sInfo.data, sInfo.drawDWindowID, $
- sInfo.drawXSize, sInfo.drawYSize, $
- sInfo.highColor, $
- AX=sInfo.xRotation, AZ=sInfo.zRotation, $
- NLEVELS=sInfo.nlevels
- end
-
- ; Create filled contour plot.
- ;
- 2 : begin
- WIDGET_CONTROL, sInfo.wLevelSlider, SENSITIVE=1
- MakeFill , sInfo.data, sInfo.drawDWindowID, $
- sInfo.drawXSize, sInfo.drawYSize, $
- sInfo.highColor, $
- AX=sInfo.xRotation, AZ=sInfo.zRotation, $
- NLEVELS=sInfo.nlevels
- end
-
- ; Create contour lines with vaious line styles.
- ;
- 3 : begin
- WIDGET_CONTROL, sInfo.wLevelSlider, SENSITIVE=1
- MakeLinestyle , sInfo.data, sInfo.drawDWindowID, $
- sInfo.drawXSize, sInfo.drawYSize, $
- sInfo.highColor, $
- AX=sInfo.xRotation, AZ=sInfo.zRotation, $
- NLEVELS=sInfo.nlevels
- end
-
- ; Create contour with annotations.
- ;
- 4 : begin
- WIDGET_CONTROL, sInfo.wLevelSlider, SENSITIVE=0
- MakeAnnotation , sInfo.data, sInfo.drawDWindowID, $
- sInfo.drawXSize, sInfo.drawYSize, $
- sInfo.highColor, $
- AX=sInfo.xRotation, AZ=sInfo.zRotation, $
- NLEVELS=7
- end
-
- ; Create filled contour with overlaying lines.
- ;
- 5 : begin
- WIDGET_CONTROL, sInfo.wLevelSlider, SENSITIVE=1
- MakeFillAndLine , sInfo.data, sInfo.drawDWindowID, $
- sInfo.drawXSize, sInfo.drawYSize, $
- sInfo.highColor, $
- AX=0, AZ=0, $
- NLEVELS=sInfo.nlevels
- end
-
- endcase
-
- WIDGET_CONTROL, sEvent.top, SET_UVALUE=sInfo, /NO_COPY
-
- ; Handle all the other possible events.
- ;
- endif else begin
-
- case eventUValue of
-
- ; Quit his application.
- ;
- 'QUIT' : begin
- WIDGET_CONTROL, sEvent.top, /DESTROY
- end
-
- ; Display the information file.
- ;
- 'ABOUT' : begin
- if( Xregistered('XDisplayFile') ne 0) then RETURN
- XDisplayFile, filepath('contr.txt', $
- SUBDIR=['examples','demo','demotext']), $
- DONE_BUTTON='Done', $
- TITLE="About contour plots" , $
- GROUP=sEvent.top, WIDTH=55, HEIGHT=14
- end ; of ABOUT
-
- ELSE : ; do nothing
-
- endcase ; of eventUValue
-
- endelse
-
- end ; of d_contour_Event
-
- ;--------------------------------------------------------------------
- ;
- pro D_ContourCleanup, wTopBase
-
- ; Get the color table saved in the window's user value.
- ;
- WIDGET_CONTROL, wTopBase, GET_UVALUE=sInfo,/No_Copy
-
- ; Restore the previous color table.
- ;
- TVLCT, sInfo.colorTable
-
- ; Restore the previous plot font.
- ;
- !P.FONT = sInfo.plotFont
-
- ; Delete the pixmap.
- ;
- for i = 0, sInfo.nPixmap-1 do begin
- WDELETE, sInfo.pixmapArray[i]
- endfor
-
- ; Restore default margins.
- ;
- !X.MARGIN = [10, 3]
- !Y.MARGIN = [4, 2]
-
- if WIDGET_INFO(sInfo.groupBase, /VALID_ID) then $
- WIDGET_CONTROL, sInfo.groupBase, /MAP
-
- end ; of CleanupForecast
-
- ;--------------------------------------------------------------------
- ;
- ; PURPOSE
- ;
- pro D_Contour, $
- GROUP=group, $ ; IN: (opt) group identifier
- APPTLB = appTLB ; OUT: (opt) TLB of this application
-
- ; Check the validity of the group identifier.
- ;
- ngroup = N_ELEMENTS(group)
- if (ngroup NE 0) then begin
- check = WIDGET_INFO(group, /VALID_ID)
- if (check NE 1) then begin
- print,'Error, the group identifier is not valid'
- print, 'Return to the main application'
- RETURN
- endif
- groupBase = group
- endif else groupBase = 0L
-
- ; Get the current color table. It will be restored when exiting.
- ;
- TVLCT, savedR, savedG, savedB, /GET
- colorTable = [[savedR],[savedG],[savedB]]
-
- ; Get the screen size.
- ;
- DEVICE, GET_SCREEN_SIZE = screenSize
-
- ; Create the starting up message.
- ;
- drawbase = startmes(GROUP=groupBase)
-
- ; Also save the font.
- ;
- plotFont = !P.FONT
-
- ; Get the character scaling factor.
- ;
- charscale = 8.0/!d.X_CH_SIZE
-
- ; Load a new color table.
- ;
- LOADCT, 5, /SILENT
- highColor = !D.TABLE_SIZE-18
- TEK_COLOR, highColor+1, 16
-
- ; Use hardware-drawn font.
- ;
- !P.FONT=0
-
- ; Set up the drawing area size.
- ;
- drawXSize = 0.6 * screenSize[0]
- drawYSize = 0.8 * drawXSize
-
- ; Set the rotation degrees of x and z axes.
- ; Set the initial number of contour levels.
- ;
- xRotation = 0
- zRotation = 0
- nLevels = 15
-
- ; Get the tips.
- ;
- sText = getTips(filepath('contr.tip', $
- SUBDIR=['examples','demo', 'demotext']) )
-
- ; Create the widgets.
- ;
- wTopBase = WIDGET_BASE(TITLE="Contour Plot / World Elevation", $
- /TLB_KILL_REQUEST_EVENTS, $
- MAP=0, $
- /COLUMN, GROUP_LEADER=groupBase, $
- TLB_FRAME_ATTR = 1, MBAR=barBase)
-
-
- ; Create the menu bar items.
- ;
- wFileButton = WIDGET_BUTTON(barBase, VALUE='File')
-
- wQuitButton = WIDGET_BUTTON(wFileButton, VALUE='Quit', $
- UVALUE='QUIT')
-
- wHelpButton = WIDGET_BUTTON(barBase, VALUE='About', /HELP)
-
- wAboutButton = WIDGET_BUTTON(wHelpButton, $
- VALUE='About contours', $
- UVALUE='ABOUT')
-
- ; Create 2 selections bases : direct and object graphics.
- ;
- wSelectionBase = LONARR(2)
- wTempBase = WIDGET_BASE(wTopbase)
- for i=0, N_ELEMENTS(wSelectionbase)-1 do begin
- wSelectionbase[i] = WIDGET_BASE(wTempBase, $
- UVALUE=0L, /COLUMN, MAP=0)
- endfor
-
- ; Create the left and right bases (direct graphics).
- ;
- wTopRowDBase = WIDGET_BASE(wSelectionBase[0], $
- UVALUE='DIRECT', COLUMN=2)
-
- wLeftDBase = WIDGET_BASE(wTopRowDBase, /COLUMN)
-
- wSelectDButton = CW_BGROUP(wLeftDBase, $
- ['Basic', 'Colored Lines', $
- 'Fill', 'Linestyle', $
- 'Annotation', 'Fill and Lines'], $
- SET_VALUE=1, $
- UVALUE='SELECTD', /EXCLUSIVE,/NO_RELEASE)
-
- wLevelLabel = WIDGET_LABEL(wLeftDBase, $
- VALUE='15', /ALIGN_CENTER)
-
-
- wLevelSlider = WIDGET_SLIDER(wLeftDBase, $
- MINIMUM=1, MAXIMUM=3, VALUE=3, $
- /SUPPRESS_VALUE, $
- TITLE='Number of Levels', $
- UVALUE='NLEVELS')
-
- wRightDBase = WIDGET_BASE(wTopRowDBase, /COLUMN)
-
- wAreaDDraw = WIDGET_DRAW(wRightDBase, XSIZE=drawXSize, $
- YSIZE=drawYSize, RETAIN=2)
-
- ; Create tips texts.
- ;
- wStatusBase = WIDGET_BASE(wTopBase, MAP=0, /ROW)
-
- nWidgets = 2
- wText = LONARR(nWidgets)
- widTips, wStatusBase, sText.text, XSIZE=36, $
- YSIZE=3, NWIDGETS=nWidgets, wText
-
- ; Realize the widget hierarchy.
- ;
- WIDGET_CONTROL, wTopBase, /REALIZE
-
- ; Returns the top level base to the APPTLB keyword.
- ;
- appTLB = wtopBase
-
- ; Size the tips widgets.
- ;
- sizeTips, wTopBase, wText, wStatusBase
-
- WIDGET_CONTROL, wTopBase, SENSITIVE=0
- WIDGET_CONTROL, wSelectDButton, SET_VALUE=0
-
-
- ; Determine the window value of plot window, wDraw1.
- ;
- WIDGET_CONTROL, wAreaDDraw, GET_VALUE=drawDWindowID
-
-
- ; Create 3 pixmaps.
- ;
- nPixmap = 1
- pixmapArray = LONARR(nPixmap)
- for i = 0, nPixmap-1 do begin
- Window, /FREE, XSIZE=drawXSize, YSIZE=drawYSize, /PIXMAP
- pixmapArray[i] = !D.Window
- endfor
-
- ; Open and read the world elevation data file.
- ;
- world_elev = BYTARR(360, 360, /Nozero)
- GET_LUN, data_lun
- OPENR, data_lun, filepath('worldelv.dat', $
- SUBDIR=['examples', 'data'])
- READU, data_lun, world_elev
- CLOSE, data_lun
- FREE_LUN, data_lun
-
- world_elev = REBIN(world_elev, 90, 45)
-
- data = world_elev
- data2 = world_elev
-
- ; Make the fill contour with line the default.
- ; of the direct graphics.
- ;
- MakeFillAndLine , data, drawDWindowID, $
- drawXSize, drawYSize, highColor, $
- AX=xRotation, AZ=zRotation, NLEVELS=nlevels
-
- ; Destroy the starting up window.
- ;
- WIDGET_CONTROL, drawbase, /DESTROY
-
- ; Map the top level base.
- ;
- WIDGET_CONTROL, wTopBase, MAP=1
-
- WIDGET_CONTROL, wSelectionBase[0], MAP=1
- WIDGET_CONTROL, wSelectDButton, SET_VALUE=5
-
- ; Create the info structure.
- ;
- sInfo = { $
- SText: sText, $ ; Text structure for tips
- Data: data, $ ; Elevation data
- XRotation: xRotation, $ ; X axis rotation (direct graphics)
- ZRotation: ZRotation, $ ; Z axis rotation (direct graphics)
- NLevels: nLevels, $ ; Number of contour levels
- Highcolor: highColor, $ ; Color index of highest color.
- CurrentBase: wSelectionBase[0], $ ; Indicates the current base
- DrawXSize: drawXSize, $ ; X size of drawing area
- DrawYSize: drawYSize, $ ; Y size of drawing area
- ColorTable:colorTable, $ ; Color table to restore at exit
- CharScale: charScale, $ ; Character scaling factor
- NPixmap: nPixmap, $ ; Number of pixmaps
- PixmapArray: pixmapArray, $ ; Array of pixmap ID
- DrawDWindowID: drawDWindowID, $ ; Direct graphics window ID
- WTopBase: wTopBase, $ ; Top level base
- WSelectDButton: wSelectDButton, $ ; Selection button ID
- WLevelSlider: wLevelSlider, $ ; Number of contour level slider
- WLevelLabel: wLevelLabel, $ ; Number of selected levels label
- WSelectionBase: wSelectionBase, $ ; Slection base ID
- WText: wText, $ ; Widget text ID for tips
- plotFont: plotFont, $ ; Font ID
- groupBase: groupBase $ ; Base of Group Leader
- }
-
- ; Register the info structure
- ; in the user value of the top-level base.
- ;
- WIDGET_CONTROL, wTopBase, SET_UVALUE=sInfo, /NO_COPY
-
- WIDGET_CONTROL, wTopBase, SENSITIVE=1
-
- ; Register with the XMANAGER.
- ;
- XMANAGER, "D_Contour", wTopBase, $
- /NO_BLOCK, $
- EVENT_HANDLER = "D_Contour_Event",CLEANUP="D_ContourCleanup"
-
- end ; of d_contour
-